home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / Studio32.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  12.7 KB  |  365 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        Studio32.vu
  5. #
  6. #    Contains:    Quick look test script for Studio/32 version 1.20
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.9>    12/14/93    KTA        gOpenFileHook2 is now defined as CheckForDiskBuffer()
  19. #     <1.0.8>    12/13/93    KTA        ModifyDocuement returns a -1 if the the scrapbbok test fails.
  20. #     <1.0.7>     10/5/93    KTA        Added DialogCheck to handle disk buffer dialog that appears
  21. #                                    sometimes.
  22. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  23. #                                    launchTwitch().
  24. #     <1.0.5>     9/28/93    KTA        Added returnVal for ModifyDocument hook.
  25. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  26. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  27. #
  28. # ****************************************************************************
  29. #
  30.  
  31.  
  32.  
  33. ########################################################################
  34. #                            External libraries 
  35. #=======================================================================
  36. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  37.  
  38.  
  39. #########################################################################
  40. ########               Application Specific Tasks
  41. #########################################################################
  42.  
  43. #########################################################################
  44. #                        InitAppGlobals()
  45. #========================================================================
  46. # Author:        GS
  47. # Description:    Sets up tools and fonts for Studio/32.  This task
  48. #                must be called first.
  49. # Parameters:    None
  50. # Returns:        Nothing
  51. # Examples:        InitAppGlobals()
  52. #========================================================================
  53. # History:
  54. #
  55. ########################################################################
  56. task InitAppGlobals()
  57. begin
  58.     
  59.     logstr("setting up {global gApptitle}'s globals");            
  60.     global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
  61.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal, gTextStr ;
  62.  
  63.     global kToolPaletteNum         := 1; 
  64.     global kColorPaletteNum     := 6;
  65.     global kPatternPaletteNum     := 4;
  66.     global kGradientPaletteNum    := 5;
  67.     global kLinePaletteNum        := 2;
  68.  
  69.     global gPaletteList := {
  70.                             {     
  71.                             {'Tools',18},                #Main Tool Matrix (Pallete #1)
  72.                             kPalWind,
  73.                             {3,8},                        #tool matrix
  74.                             {28,20}                        #tool offset
  75.                             },
  76.                             
  77.                             {
  78.                             {26,286, 45,278},            #Pen size popup (Pallete #2)
  79.                             kPopUpPal,
  80.                             {10,10},
  81.                             {13,13}
  82.                             },
  83.                             
  84.                             {
  85.                             {66,285, 89,282},        #Zoom in/out popup (Pallete #3)
  86.                             kPopUpPal,
  87.                             {8,1},
  88.                             {18,0}
  89.                             },
  90.                             
  91.                             {
  92.                             {43,309, 83,304},        #Patterns (Pallete #4)
  93.                             kPopUpPal,
  94.                             {13,3},
  95.                             {20,17}
  96.                             },
  97.                             
  98.                             {
  99.                             {49,329, 92,324},        #Gradient (Pallete #5)    
  100.                             kPopUpPal,
  101.                             {1,2},
  102.                             {0,9}
  103.                             },
  104.                             
  105.                             {
  106.                             {44,367, 87,346},        #Colors (Pallete #6)
  107.                             kPopUpPal,
  108.                             {32,8},
  109.                             {9,9}
  110.                             }
  111.                         };
  112.  
  113.     ### Palette Elements:=        Tool#, Pal#,     ToolName,         ToolType,    DblClktoEnd        SetAttributes
  114.     global FreeSelectTool     :=     { 1,  1,        "FreeSelect",    kMultiDrag, 0,                {0}                };
  115.     global RectSelectTool    :=    { 2,  1,        "RectSelect",     kDrag,        0,                {0}                };
  116.     global WandTool            :=    { 3,  1,        "MagicWand",     kClick,        0,                {0}                };
  117.     global CharTool         :=     { 4,  1,        "CharTool",     kClick,        0,                {}        };
  118.     global HandTool            :=  { 5,  1,        "HandTool",     kDrag,      0,              {0}                };
  119.     global Eraser            :=  { 6,  1,        "Eraser",        kMultiDrag, 0,                {0}                };
  120.     global AirBrush            :=  { 7,  1,        "AirBrush",        kMultiDrag, 0,                {1,0,0,1}        };
  121.     global PaintBrush        :=    { 8,  1,         "PaintBrush",    kMultiDrag,    0,                {1,1,0,1}        };
  122.     global FillTool            :=  { 9,  1,        "FillTool",        kClick,        0,                {1,0,0,1}        };
  123.     global BlendTool        :=    {10,  1,        "BlendTool",    kMultiDrag, 0,              {0}                };
  124.     global SmudgeTool        :=  {11,  1,        "SmudgeTool",    kMultiDrag,    0,                {0}                };
  125.     global CloneBrushTool   :=  {12,  1,        "CloneBrush",    kMultiDrag, 0,                 {1,1,0,1}       };
  126.     global ColorPickup        :=  {13,  1,        "ColorPickup",    kClick,        0,                {0}                };
  127.     global PencilTool        :=  {14,  1,        "PencilTool",    kMultiDrag,    0,                {1,0,0,1}        };
  128.     global LineTool         :=     {15,  1,         "Line",            kDrag,         0,                {1,0,1,0}        };
  129.     global RectTool         :=     {16,  1,        "Rectangle",    kDrag,        0,                {1,1,1,1}        };
  130.     global RndRectTool         :=     {17,  1,         "RndRect",        kDrag,        0,                {1,1,1,1}        };
  131.     global OvalTool         :=     {18,  1,        "Oval",            kDrag,         0,                {1,1,1,1}        };
  132.     global RotateOvalTool   :=  {19,  1,        "RotateOval",    kDragClick,    0,                {1,1,1,1}        };
  133.     global RotatePolygon    :=  {20,  1,        "RotatePolygon",kDragClick,    0,                {1,1,1,1}        };
  134.     #global PolyTool         :=     {21,  1,         "Polygon",        kMultiClick,1,                {1,1,1,1}        };
  135.     global FreeTool         :=     {22,  1,         "Freehand",        kMultiDrag, 0,                {1,1,1,1}        };
  136.     global CurveTool         :=     {23,  1,         "Curve",        kDragClick, 0,                {1,1,1,1}        };
  137.     #global BezTool         :=     {24,  1,         "BezTool",        kMultiClick,1,                {2,1,1,1}        };
  138.  
  139.     # VU loses contact w/target when using Poly Tool
  140.     
  141.     #global ColorPickerTool     :=     { 12, 1,         "ColorPicker",    kClick, 0,                {0}                };
  142.     #global PenLine             :=     { '', {87,29,1}, "PenLine",        0,         0,                {0}                };
  143.     #global ZoomOut             :=     { '', {30,-8,2}, "ZoomOut",        0,         0,                {0}                };
  144.  
  145.     # global Tool list
  146.     global gToolList:={    FreeSelectTool,
  147.                         RectSelectTool,
  148.                         WandTool,
  149.                         #CharTool,
  150.                         HandTool,
  151.                         Eraser,
  152.                         AirBrush,
  153.                         PaintBrush,
  154.                         FillTool,
  155.                         BlendTool,
  156.                         SmudgeTool,
  157.                         CloneBrushTool,
  158.                         ColorPickup,
  159.                         PencilTool,
  160.                         LineTool,
  161.                         RectTool,
  162.                         RndRectTool,
  163.                         OvalTool,
  164.                         RotateOvalTool,
  165.                         RotatePolygon,
  166.                         #PolyTool,
  167.                         FreeTool
  168.                       };
  169.                      
  170.             ### font characteristic lists
  171.     global gFontSizeList := {'9','10','12','14','18', '24','36','48','72','96'};
  172.     global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow', 'Condense','Extend'};
  173.  
  174.         ### Name of the Plain (style) menu item  ####
  175.     global gPlainStyle := "Plain Text";            # Plain-Style menu item
  176.  
  177.         ### How to get to the next line
  178.     global gNextLineMethod := 1;            
  179.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  180.     
  181.         ### Does moving to the next line clear all font info
  182.     global gNextLineClearsFontSettings := 0;
  183.  
  184.     global gWindowInset := {10,30,30,30};        # Inset to wind to get content region
  185.  
  186.     global gDoWindowList := {1,1,1,0};    # zooming causes window to disappear in studio/32
  187.                       
  188. end;  #InitStudio32Globals
  189.  
  190. #########################################################################
  191. #                        DeselectScrapPaste()
  192. #========================================================================
  193. # Author:        GS
  194. # Description:    Deselects paste from scrap before calling next routine.
  195. #                Called from DoSetUpApp
  196. # Parameters:    None
  197. # Returns:        Nada
  198. # Examples:        global gSetupScrapText := Task DeselectScrapPaste;
  199. # Assumptions:    Studio/32
  200. #========================================================================
  201. # History:
  202. #
  203. #########################################################################
  204. task DeSelectScrapPaste() 
  205. begin
  206.     logstr("Deselecting the selected area...");
  207.     MoveRelativeToWindow(10,25,2,2);
  208. end;
  209.  
  210. #########################################################################
  211. #                        Studio32ScrapText()
  212. #========================================================================
  213. # Author:        GS
  214. # Description:    Test scrap text
  215. # Parameters:    None
  216. # Returns:        Nada
  217. # Assumptions:    Studio/32
  218. #========================================================================
  219. # History:
  220. #
  221. #########################################################################
  222. Task Studio32ScrapText() 
  223. begin
  224.     scrapbook(global kScrapText);
  225.     DeSelectScrapPaste();
  226. end;
  227.  
  228. #########################################################################
  229. #                        Studio32Zoom()
  230. #========================================================================
  231. # Author:        GS
  232. # Description:    Test zooming window
  233. # Parameters:    None
  234. # Returns:        Nada
  235. # Assumptions:    Studio/32
  236. #========================================================================
  237. # History:
  238. #
  239. #########################################################################
  240. Task Studio32Zoom() 
  241. begin
  242.     ZoomWindow();    # window disappears
  243.     TypeStr(" ");    # to normal mode is press the space bar
  244. end;
  245.  
  246. #########################################################################
  247. #                        Studio32SetupDoText()
  248. #========================================================================
  249. # Author:        GS
  250. # Description:    setup dotext
  251. # Parameters:    None
  252. # Returns:        Nada
  253. # Assumptions:    Studio/32
  254. #========================================================================
  255. # History:
  256. #
  257. #########################################################################
  258. Task Studio32SetupDoText() 
  259. begin
  260.     logstr("setting up for DoText...");
  261.     Draw(global CharTool);       # Select and click with the chartool 
  262. end;
  263.  
  264. #########################################################################
  265. #                            Studio32ModifyDocument()
  266. #========================================================================
  267. # Author:        ML
  268. # Description:    Modify Studio/32 Document
  269. # Parameters:    None
  270. # Returns:        Nothing
  271. # Examples:        Studio32ModifyDocument();
  272. # Assumptions:    None 
  273. # Applications:    Studio/32
  274. #========================================================================
  275. # History:
  276. #
  277. #########################################################################
  278. task Studio32ModifyDocument()
  279. begin
  280.     retVal := Scrapbook(global kScrapTEXT);
  281.     if not(retVal)
  282.         retVal := -1;        # ScrapBook failed so can't modifyDoc
  283.     else
  284.         retVal := 1;
  285.         
  286.     return(retVal);
  287. end;
  288.  
  289. #########################################################################
  290. #                            Studio32SetupDoWindow()
  291. #========================================================================
  292. # Author:        ML
  293. # Description:    Setup DoWindow in Studio/32
  294. # Parameters:    None
  295. # Returns:        Nothing
  296. # Examples:        Studio32SetupDoWindow();
  297. # Assumptions:    None 
  298. # Applications:    Studio/32
  299. #========================================================================
  300. # History:
  301. #
  302. #########################################################################
  303. task Studio32SetupDoWindow()
  304. begin
  305.     if match [window t:'Tools']
  306.         SelectMenuItem("Hide Tools Window","Windows");
  307. end;
  308.  
  309. #########################################################################
  310. #                            CheckForDiskBuffer()
  311. #========================================================================
  312. # Author:        KA
  313. # Description:    Check for a dialog that appears when opening files.
  314. # Parameters:    None
  315. # Returns:        Nothing
  316. # Examples:        CheckForDiskBuffer();
  317. # Assumptions:    None 
  318. # Applications:    Studio/32
  319. #========================================================================
  320. # History:
  321. #
  322. #########################################################################
  323. Task CheckForDiskBuffer()
  324. begin
  325.     Wait(5);
  326.     DialogCheck("disk buffer",1);        # To handle a dialog that may appear
  327. end;
  328.  
  329. ################################################################################
  330. ####################             Main script                    ####################
  331. ################################################################################
  332. script Studio32 (ScriptLevel:= -1)
  333. begin
  334.     InitGlobals(ScriptLevel);            # initialize your general globals
  335.     InitDraw();
  336.     InitFonts();
  337.     Global gApptitle := "Studio/32";
  338.     global gAppVersion := '1';        # version of app you will be running
  339.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  340.     Global gLaunchReqs := {'no68K'};
  341.     SuiteStart('Studio32.vu');                    # begin a new test suite
  342.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  343.     begin
  344.  
  345.         Global gCustomScrapText := Task Studio32ScrapText;
  346.         Global gSetUpForSaveDoc:= Task DeselectScrapPaste;
  347.         global gSetupDoText:= task Studio32SetupDoText;        # define app specific task
  348.         global gModifyDocument:= task Studio32ModifyDocument; # define app specific task
  349.         global gSetupDoWindow:= task Studio32SetupDoWindow; # define app specific task
  350.         global gOpenFileHook2 := task CheckForDiskBuffer;
  351.          InitAppGlobals();                                    # init app specific globals
  352.         (*
  353.         *)
  354.         wait(2);
  355.         DialogCheck("disk buffer",1);        # To handle a dialog that may appear
  356.  
  357.         DoSetUpApp(,,,1,1,1,1);
  358.         DoDraw();
  359.         DoText();
  360.         DoWindow();                            
  361.         Studio32Zoom();                        # custom task for Studio/32 zoom test
  362.         DoCloseApp(1,-1);
  363.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  364.     SuiteEnd();
  365. end; # script Studio32